<template>
  <div>
    <div class="detail">
      <v-navMenu
        :detailNav="detailNav"
        :menuData="menuData"
        @setMentActive="setMentActive"
      ></v-navMenu>
      <component
        :inputData="detailData"
        :is="currentComponent"
        ref="comRef"
      ></component>
    </div>
  </div>

</template>

<script>
import navMenu from "@/components/commons/NavMenu";
import baseMixin from "@/mixins/BaseMixin";
import config from "./Config";

export default {
  name: "Detail",
  mixins: [baseMixin, config],
  data () {
    return {
      flag: true,
      newFlag: false,
      selectData: [],
      detailData: {},
      detailNav: "1",
      componentConfig: [
        {
          name: "kwscDetailListPage",
          label: this.$t('manage.switch'),
          component: () => import('./page/openClose.vue')
        },
        {
          name: "kwsdDetailListPage",
          label: this.$t('manage.effective'),
          component: () => import('./page/value.vue')
        },
      ],
    }
  },
  computed: {

    currentComponent () {
      return this.componentConfig[this.detailNav - 1].component;
    },

  },
  methods: {
    setMentActive (key) {
      this.detailNav = key;
    },

    //选中的数据
    setSelectData (data) {
      this.selectData = data;
    },

  },
  mounted () {
    if (this.$store.state.temporary) {
      this.detailNav = this.$store.state.temporary
    }

  },
  components: {
    "v-navMenu": navMenu,
  },
  watch: {

  }

}
</script>

<style scoped>
</style>
